//
//  QTTPublicBtn.m
//  QuTouTiao
//
//  Created by 杨杨子 on 2018/6/30.
//  Copyright © 2018年 杨杨子. All rights reserved.
//

#import "QTTPublicBtn.h"

@implementation QTTPublicBtn

-(instancetype)initWithFrame:(CGRect)frame
                   andTittle:(NSString *)tittle
              AndTittleColor:(UIColor *)tittleColor
               AndTittleFont:(CGFloat)font
                AndBackColor:(UIColor *)backColor
               AndFatherView:(UIView *)fatherView{
    self = [super initWithFrame:frame];
    if (self) {
        [self setTitle:tittle forState:UIControlStateNormal];
        [self setTitleColor:tittleColor forState:UIControlStateNormal];
        [self.titleLabel setFont:[UIFont systemFontOfSize:font]];
        self.backgroundColor = backColor;
        [fatherView addSubview:self];
    }
    return self;
}
-(instancetype)initWithFrame:(CGRect)frame
                   andTittle:(NSString *)tittle
              AndTittleColor:(UIColor *)tittleColor
               AndTittleFont:(CGFloat)font
                AndBackColor:(UIColor *)backColor
               AndFatherView:(UIView *)fatherView
              AndBorderColor:(UIColor *)borderColor
              AndBorderWidth:(CGFloat)borderWidth
          AndHasCornerRadius:(BOOL)hasCornerRadius{

    self = [self initWithFrame:frame andTittle:tittle AndTittleColor:tittleColor AndTittleFont:font AndBackColor:backColor AndFatherView:fatherView];
    if (self) {
        self.layer.borderColor = borderColor.CGColor;
        self.layer.borderWidth = borderWidth;
        if (hasCornerRadius) {
            self.layer.cornerRadius = 4;
            self.layer.masksToBounds = YES;
        }
    }
    return self;
}

@end
